Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

130
Views
How to override padding inherited from "@ .MuiAlert-icon"?

I need to override the padding inherited from "@ .MuiAlert-icon". The inspector from chrome shows

.MuiAlert-icon {
    display: flex;
    opacity: 0.9;
    padding: 7px 0;
    font-size: 22px;
    margin-right: 12px;
}

I'm trying to override it using the makeStyles from material UI. Here's the code i'm trying.

import Alert from "@material-ui/lab/Alert";
import Icon from "@material-ui/core/Icon";
import {  makeStyles } from "@material-ui/core";
  
const useStyles = makeStyles({
  icon: {
    overflow: 'visible',
    "& .MuiAlert-icon": {
      padding: 'none',
    }

  },
  outerTheme: {

  }
});
  
interface idVerifyProps {
    status: string; 
  }


const IDverify = ({ status }: idVerifyProps) => {
  const classes = useStyles();
  const svgIcon = (
    <Icon className={classes.icon}>
      <img alt="edit" src="../../../checkIcon.png" />
    </Icon>
  );
    return (
      <div >
        <Alert severity="error" style={{ backgroundColor: "#E6FFE9",}} icon={svgIcon}>{status}</Alert>
      </div>
    );
  };
  export default IDverify;

I don't know where the 7px padding is coming from. I'm assuming its just a default setting for whatever reason with the Icon component. I just need to set the padding to zero.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

you need to use classes={{ icon: <your_class> }}

alertIcon: {
  padding: 0,
},
return (
      <div >
         <Alert
            severity="error"
            style={{ backgroundColor: "#E6FFE9",}}
            icon={svgIcon}
            classes={{ icon: classes.alertIcon }}
         >
           {status}
         </Alert>
      </div>
    );

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!